var t,
  a = require("../../@babel/runtime/helpers/defineProperty"),
  i = require("../../res/www.a9a.cn.js"),
  n = getApp(),
  e = 2,
  o = !0;
Page({
  data: {
    nTitle: "客户表单报名",
    t: 0,
    triggered: !0,
    loading_flag: !1,
    loading_ico_flag: !1,
    loading_str: "玩命加载中",
  },
  onLoad: function (t) {
    var a = this;
    wx.setNavigationBarTitle({ title: a.data.nTitle }),
      n.get_config("_ZEAI").then(function (t) {
        a.setData({ color: n._ZEAI.color, rgbcolor: i.c16_rgb(n._ZEAI.color) });
      }),
      n.get_navigationBarTopHeight(a),
      this.init();
  },
  init: function () {
    var i = this;
    wx.showLoading({ title: "玩命加载中...", mask: !0 }),
      (o = !1),
      (t = wx.getStorageSync("COOK_U")),
      n.ajax({
        url: "form.php",
        data: { submitok: "form", openid: t.openid, t: i.data.t },
        success: function (t) {
          var n;
          1 == t.flag
            ? 0 == t.LIST.length
              ? i.setData({
                  LIST: [],
                  form_nodata: !0,
                  nTitle: t.nTitle,
                  SHARE: t.SHARE,
                })
              : (console.log(t.LIST.length),
                i.setData(
                  (a((n = {}), "LIST[0]", t.LIST),
                  a(n, "nTitle", t.nTitle),
                  a(n, "SHARE", t.SHARE),
                  n)
                ))
            : wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          (o = !0), wx.hideLoading();
        },
      });
  },
  tFn: function (t) {
    var a = t.currentTarget.dataset.t;
    this.setData({
      triggered: !1,
      loading_flag: !1,
      loading_str: "拼命加载中",
      LIST: [],
      form_nodata: !1,
      t: a,
    }),
      this.init();
  },
  nodatabackFn: function () {
    this.setData({
      triggered: !1,
      loading_flag: !1,
      loading_str: "拼命加载中",
      LIST: [],
      form_nodata: !1,
      t: 0,
    }),
      this.init();
  },
  onPullDownRefresh: function () {
    var t = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        t.setData({
          triggered: !1,
          loading_flag: !1,
          loading_str: "拼命加载中",
          LIST: [],
          form_nodata: !1,
          t: 0,
        }),
          t.setloading("end", "拼命加载中"),
          (e = 2),
          t.init();
      }, 500);
  },
  setloading: function (t, a) {
    "start" == t
      ? this.setData({ loading_flag: !0, loading_ico_flag: !0, loading_str: a })
      : this.setData({
          loading_flag: !1,
          loading_ico_flag: !1,
          loading_str: a,
        });
  },
  onReachBottom: function () {
    var i = this.data.LIST,
      r = this;
    if (o) {
      (o = !1), r.setloading("start", "拼命加载中");
      var s = { submitok: "party", p: e, openid: t.openid, t: r.data.t };
      n.ajax({
        url: "form.php",
        data: s,
        success: function (t) {
          if (1 == t.flag) {
            var n = i.length;
            if (t.LIST.length < 1)
              return r.setloading("end", "已全部加载完毕"), void (o = !1);
            r.setData(a({}, "LIST[" + n + "]", t.LIST)), (e += 1), (o = !0);
          } else wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          r.setloading("end", "上拉加载更多");
        },
      });
    }
  },
  binnd_scroll: function (t) {
    t.detail.scrollTop > 100
      ? this.setData({ backtop_flag: !0 })
      : this.setData({ backtop_flag: !1 });
  },
  backtopFn: function (t) {
    var i = "scrolltopNum_" + t.currentTarget.dataset.id;
    this.setData(a({}, i, 0));
  },
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      path: "/pages/form/form",
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      query: "",
      path: "/pages/form/form",
    };
  },
});
